package com.example.share.controller;

import com.example.share.pojo.User;
import com.example.share.service.MyService;
import com.example.share.util.CommonResult;
import com.example.share.util.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class MyConreoller {
    @Autowired
    private MyService myService;


    //返回用户信息
    @RequestMapping("/in")
    //private CommonResult<User> showUser(@RequestParam("username") String name){
    private CommonResult  showUser(){
    //private String  showUser(){
        //前端传入用户id
        int userId=1;

        User user = myService.finduser(userId);
        System.out.println(user);
        //return "su";
        return new CommonResult(ResultCode.SUCCESS,user);
    }
}
